import { BackSide, Mesh, MeshBasicMaterial, MeshLambertMaterial, SphereGeometry, TextureLoader } from "three";
import worldBgImg from '@/assets/imgs/worldBg.jpg';
import { MyThings } from "@/interfaces/myThings.interface";


class WorldBg implements MyThings {
  mesh: Mesh;
  loaded: Promise<void>;
  constructor() {
    this.mesh = new Mesh();
    this.mesh.name = "workdBg";
    this.loaded = this.init();
  }
  async init() {
    const textLoader = new TextureLoader();
    const textureLoader = await textLoader.loadAsync(worldBgImg);
    this.mesh.geometry = new SphereGeometry(2000, 50, 50);
    this.mesh.material = new MeshBasicMaterial({
      side: BackSide,
      map: textureLoader
    });
    this.mesh.position.set(0, 1000, 0);
  }
  update: () => void;
}
const worldBg = new WorldBg();
export { worldBg };
